Ext.define('appmod.view.knowledge.content.colligation.Form', {
    extend: 'Ext.form.Panel',
    alias: [
		'widget.knowledge.content.colligation.form',
		'widget.knowledge-content-colligation-form'
	],
	requires: [
		'Ext.ux.TreePicker'
	],	
    bodyPadding: 10,
	
	constructor: function (config) {
		
		if (config.fieldStores) {
			this.fieldStores = config.fieldStores;
		}
        this.callParent(arguments);
     },	
	
    initComponent: function() {
      var me = this;

		var emptyStore = Ext.create('Ext.data.TreeStore',
		{
			root:
			{
				text: '信息分类',
				id: 'root',
				expanded: true,
				children:
				[
				]
			},
			folderSort: false
		});
		
		var dsCatelog = emptyStore;
		
		if (me.fieldStores != null) {
			if (me.fieldStores['dsCategory']) {
				dsCatelog = me.fieldStores['dsCategory'];
			}
		}
	  
      Ext.applyIf(me, {
	  	    fieldDefaults: {
            	labelWidth: 80
        	},
			autoScroll:true,
            items: [
                {
                    xtype: 'hiddenfield',
					name:'id',
                    anchor: '100%'
                },			
				{
                    xtype: 'textfield',
                    name: 'title',
                    fieldLabel: '主题',
					anchor: '95%',
					allowBlank:false
                },
                {
                    xtype: 'textfield',
                    name: 'keywords',
                    anchor: '95%',
					fieldLabel: '关键字'
                },
				{
                    xtype: 'htmleditor',
                    name: 'content',
                    anchor: '95%',
					height: 250,
					fieldLabel: '内容'
                },
                {
                    xtype: 'treepicker',
                    fieldLabel: '所属分类',
					store : dsCatelog,
					displayField:'text',
					allowBlank:false,
					name:'categoryId',
                    anchor: '50%'
                },
				{
                    xtype: 'radiogroup',
                    fieldLabel: '访问级别',
                    width:200,
                    labelWidth: 60,
					items: [
                        {
                            xtype: 'radiofield',
                            boxLabel: '完全公开',
							width:70,
                            checked: false,
							inputValue:2,
							name:'shared',
							padding:'0 20 0 0 '
                        },
                        {
                            xtype: 'radiofield',
                            boxLabel: '用户组内公开',
							width:95,
                            checked: true,
							inputValue:1,
							name:'shared',
							padding:'0 20 0 0 '
                        },						
                        {
                            xtype: 'radiofield',
							inputValue:0,
							width:70,
							name:'shared',
                            boxLabel: '私有'
                        }
                    ]
                }									
							
            ]		
        });

        me.callParent(arguments);
    }

});